﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;

namespace ShoppingApp
{
    public partial class Validation : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Label1.Text = "";
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                Label1.Text = "Your reservation has been processed";
            }
            //Cannot make else statement here
        }

        protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
        {
            try
            {
                if (TextEmailTextBox.Text == NumberTextBox.Text)
                {
                    args.IsValid = true;
                }
                else
                {
                    args.IsValid = false;
                }
                
            }
            catch (Exception ex)
            {
                args.IsValid = false;
            }
        }
    }
}